<?php
class Users extends Vfriend_Db {
	var $cache;
	var $clear;
	public function __construct() {
		$this->cache = new Vfriend_Cache();
		$this->clear = $this->cache->clear;
	}
	public function getAll(	$intStatus, $intOption, $strKey, $intGender, $strCountry, 
							$intProvince, $intAfrom, $intAto, $intReligion, $intEducation, 
							$intOccupation, $intPosition, $strStart, $strEnd, $intOff, $intLimit, &$intTotal) {
		try {
			$this->prepare('call users_getall_admin(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
			$this->bindParam(1, $intStatus, PDO::PARAM_INT, 4);
			$this->bindParam(2, $intOption, PDO::PARAM_INT, 4);
			$this->bindParam(3, $strKey, PDO::PARAM_STR, 100);
			$this->bindParam(4, $intGender, PDO::PARAM_INT, 1);
			$this->bindParam(5, $strCountry, PDO::PARAM_STR, 2);
			$this->bindParam(6, $intProvince, PDO::PARAM_INT, 11);
			$this->bindParam(7, $intAfrom, PDO::PARAM_INT, 3);
			$this->bindParam(8, $intAto, PDO::PARAM_INT, 3);
			$this->bindParam(9, $intReligion, PDO::PARAM_INT, 11);
			$this->bindParam(10, $intEducation, PDO::PARAM_INT, 11);
			$this->bindParam(11, $intOccupation, PDO::PARAM_INT, 11);
			$this->bindParam(12, $intPosition, PDO::PARAM_INT, 11);
			$this->bindParam(13, $strStart, PDO::PARAM_STR, 10);
			$this->bindParam(14, $strEnd, PDO::PARAM_STR, 10);
			$this->bindParam(15, $intOff, PDO::PARAM_INT, 4);
			$this->bindParam(16, $intLimit, PDO::PARAM_INT, 4);
			$arrResult 	= $this->fetchAll();
			$intTotal	= isset($arrResult[0]['foundRows']) ? $arrResult[0]['foundRows'] : 0;
			return isset($arrResult) ? $arrResult : null;
		} catch(Exception $e) {
			Vfriend_Function::logDb('Backend_Users::getAll - ' .$e->getMessage());			
			return null;
		}
	}
}
?>